// 查机型
async function getProductFamily(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: '../handler/report/CommonActionHandle.ashx?action=getProductFamily',
    data: { type: 'getProductFamily', ...config }
  })
  return data;
}

// 查工区列表
async function getWorkcenterList(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: '../handler/report/CommonActionHandle.ashx?action=getWorkcenterList',
    data: { type: 'getWorkcenterInfo', ...config }
  })
  return data;
}

// 查询分厂指定角色人员
async function getFactoryUsersByRoleName(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getFactoryUsersByRoleName`,
    data: { type: 'getFactoryUsersByRoleName', ...config }
  })
  return data;
}

// 根据分厂代码查分厂
async function getFactoryListByCode(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getFactoryListByCode`,
    data: { type: 'getFactoryListByCode', ...config }
  })
  return data;
}

// 获取分厂列表
async function getFactory(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getFactory`,
    data: { type: 'getFactory', ...config }
  })
  return data;
}

//查询分厂信息
async function getFactoryInfo(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getFactoryInfo`,
    data: { type: 'getFactoryInfo', ...config }
  })
  return data;
}

// 查询用户信息
async function getUserInfo(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getUserInfo`,
    data: { type: 'getUserInfo', ...config }
  })
  return data[0];
}

// 查询外委厂家
async function getCustomerList(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getCustomerList`,
    data: { type: 'getCustomerList', ...config }
  })
  return data;
}

// 查询MES组织结构(分厂/工区/班组)
async function getMESOrginazition(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getMESOrginazition`,
    data: { type: 'getMESOrginazition', ...config }
  })
  return data;
}

// 查询班组
async function getTeamList(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getTeamList`,
    data: { type: 'getTeam', ...config }
  })
  return data;
}

// 查询工人列表
async function getWorkerList(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getWorkerList`,
    data: { type: 'getWorkerList', ...config }
  })
  return data;
}

// 查询分厂员工
async function getFactoryUsers(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getFactoryUsers`,
    data: { type: 'getFactoryUsers', ...config }
  })
  return data;
}

// 查询订单类别
async function getOrdertypeList(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getOrdertypeList`,
    data: { type: 'getOrdertypeList', ...config }
  })
  return data;
}

// 查询MES装配厂4级组织结构(分厂/工区/班/组)
async function getMESZSOrginazition(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getMESZSOrginazition`,
    data: { type: 'getMESZSOrginazition', ...config }
  })
  return data;
}

// 查询BPM组织架构
async function getBPMOrginazition(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getBPMOrginazition`,
    data: { type: 'getBPMOrginazition', ...config }
  })
  return data;
}

// 查询供应商列表
async function getVendorList(config) {
  const { data: { data, meta, total } } = await axios({
    method: 'post',
    url: `../handler/report/CommonActionHandle.ashx?action=getVendorList`,
    data: { type: 'getVendorList', ...config }
  })
  return data;
}

export {
  getFactoryListByCode,
  getProductFamily,
  getWorkcenterList,
  getFactoryUsersByRoleName,
  getUserInfo,
  getCustomerList,
  getFactory,
  getFactoryInfo,
  getMESOrginazition,
  getTeamList,
  getWorkerList,
  getFactoryUsers,
  getOrdertypeList,
  getMESZSOrginazition,
  getVendorList,
  getBPMOrginazition
}